package com.frxuexi.mynews.activity

import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.annotation.RequiresApi
import com.alibaba.android.arouter.facade.annotation.Route
import com.frxuexi.mynews.R
import com.frxuexi.mynews.databinding.ActivityVideoBinding

@Route(path = "/app/VideoActivity")
class VideoActivity : AppCompatActivity() {
    lateinit var db:ActivityVideoBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        db=ActivityVideoBinding.inflate(layoutInflater)
        setContentView(db.root)

        db.gsy.titleTextView.visibility=View.GONE
        db.gsy.backButton.visibility=View.GONE

        var url="http://txmov6.a.yximgs.com/upic/2020/08/31/18/BMjAyMDA4MzExODI4MTNfMTY0MzQyMjA5MF8zNTMzNzQ2NzA0NV8yXzM=_b_B798d765ecba654715115ea88db7495a5.mp4?tag=1-1599265808-vdg-1-bt0v1njxkf-e3d481d1c2527e4d&tt=b&bp=10000"
        db.gsy.setUp(url,true,"")
        db.gsy.startPlayLogic()
    }

    override fun onPause() {
        super.onPause()
        db.gsy.onVideoPause()
    }

    override fun onResume() {
        super.onResume()
        db.gsy.onVideoResume()
    }

    @RequiresApi(Build.VERSION_CODES.O)
    override fun onDestroy() {
        super.onDestroy()
        db.gsy.releasePointerCapture()
    }
}